package cool.taomu.box.git.test

import cool.taomu.toolkit.git.JGitTools
import javax.inject.Inject

class JGitTest {
	
	@Inject
	JGitTools jgit;
	
	/* @Test
	def void commitidsTest(){
		var Module m = new TaomuGuice().build(JGitTest);
		var Injector injector = Guice.createInjector(m);
		var j = injector.getInstance(JGitTest)
		val ids = new ArrayList<GitCommitInfoEntity>();
	//	j.jgit.getCommitIds("/home/rcmu/workspace/develop/taomubox",10,[
		//	println(it.time.toString("yyyy-MM-dd hh:mm:ss"));
		//	ids.add(it);
		//]);
	//	j.jgit.retrieveFileContent("/home/rcmu/workspace/develop/taomubox","/home/rcmu/workspace/develop/taomubox/taomu-git/src/main/java/cool/taomu/box/git/JGitTools.xtend",ids.map[it.id],[println(it)])
	}
	
	@Test
	def void remtoeClone(){
		var Module m = new TaomuGuiceModule().build(JGitTest);
		var Injector injector = Guice.createInjector(m);
		var j = injector.getInstance(JGitTest)
		j.jgit.cp = new UsernamePasswordCredentialsProvider("xxxx", "xxxx");
		j.jgit.repository = "https://gitee.com/iproject/testsm.git"
		j.jgit.branch = "dev"
		//j.jgit.Clone;
		//j.jgit.remoteBranchList;
	}

	@Test
	def void remoteBranchList2(){
		var Module m = new TaomuGuice.build(JGitTest);
		var Injector injector = Guice.createInjector(m);
		var j = injector.getInstance(JGitTest)
		//j.jgit.clone("https://gitee.com/iproject/fw4wdb.git",false,"master")
		println(j.jgit.logOne("https://gitee.com/iproject/fw4wdb.git"))
	}
	
	@Test
	def void remoteBranchList(){
		var JGitTools jgt = new JGitTools();
		jgt.clone("https://gitee.com/iproject/fw4wdb.git",false,"master")
		//jgt.fetchAll("https://gitee.com/iproject/fw4wdb.git")
		//jgt.pull("https://gitee.com/iproject/fw4wdb.git","master")
		println(jgt.status("https://gitee.com/iproject/fw4wdb.git"))
		println(jgt.branchList("https://gitee.com/iproject/fw4wdb.git",ListMode.REMOTE));
		println(jgt.logOne("https://gitee.com/iproject/fw4wdb.git"))
	}*/
}
